package com.eee.xiang.market.controller;


import com.eee.xiang.market.beans.OperateResponse;
import com.eee.xiang.market.common.TableData;
import com.eee.xiang.market.service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.nio.file.OpenOption;

@RestController
@RequestMapping("/order")
public class OrderManagerController {

    @Autowired
    private IOrderService orderService;

    @RequestMapping("/makeOrder")
    OperateResponse makeOrder(String orderStr){
        return orderService.makeOrder(orderStr);
    }

    @RequestMapping("/getAllOrderList")
    TableData getAllOrderList(@RequestParam(value = "page") int page,
                              @RequestParam(value = "limit") int limit){
        return orderService.getAllOrderList(page, limit);
    }

    @RequestMapping("/getAllOrderDetailList")
    TableData getAllOrderDetailList(@RequestParam(value = "page") int page,
                              @RequestParam(value = "limit") int limit){
        return orderService.getAllOrderDetailList(page, limit);
    }

    @RequestMapping("/orderListEchart")
    OperateResponse orderListEchart(){
        return orderService.orderListEchart();
    }

    @RequestMapping("/orderDetailEchart")
    OperateResponse orderDetailEchart(){
        return orderService.orderDetailEchart();
    }

    @RequestMapping("testAbstract")
    OperateResponse testAbstract(String type){
        return orderService.testAbstract(type);
    }
}
